package com.ssy.lingxi.sms.api.common;

/**
 * 错误代码
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/10/27
 */
public enum AliErrorCodeEnum {

    SMS_SIGNATURE_SCENE_ILLEGAL("isv.SMS_SIGNATURE_SCENE_ILLEGAL", "短信所使用签名场景非法"),
    EXTEND_CODE_ERROR("isv.EXTEND_CODE_ERROR", "扩展码使用错误，相同的扩展码不可用于多个签名"),
    DOMESTIC_NUMBER_NOT_SUPPORTED("isv.DOMESTIC_NUMBER_NOT_SUPPORTED", "国际/港澳台消息模板不支持发送境内号码"),
    DENY_IP_RANGE("isv.DENY_IP_RANGE", "源IP地址所在的地区被禁用"),
    DAY_LIMIT_CONTROL("isv.DAY_LIMIT_CONTROL", "触发日发送限额"),
    SMS_CONTENT_ILLEGAL("isv.SMS_CONTENT_ILLEGAL", "短信内容包含禁止发送内容"),
    SMS_SIGN_ILLEGAL("isv.SMS_SIGN_ILLEGAL", "签名禁止使用"),
    RAM_PERMISSION_DENY("isp.RAM_PERMISSION_DENY", "RAM权限不足"),
    OUT_OF_SERVICE("isv.OUT_OF_SERVICE", "业务停机"),
    PRODUCT_UN_SUBSCRIPT("isv.PRODUCT_UN_SUBSCRIPT", "未开通云通信产品的阿里云客户"),
    PRODUCT_UNSUBSCRIBE("isv.PRODUCT_UNSUBSCRIBE", "产品未开通"),
    ACCOUNT_NOT_EXISTS("isv.ACCOUNT_NOT_EXISTS", "账户不存在"),
    ACCOUNT_ABNORMAL("isv.ACCOUNT_ABNORMAL", "账户异常"),
    SMS_TEMPLATE_ILLEGAL("isv.SMS_TEMPLATE_ILLEGAL", "短信模版不合法"),
    SMS_SIGNATURE_ILLEGAL("isv.SMS_SIGNATURE_ILLEGAL", "短信签名不合法"),
    INVALID_PARAMETERS("isv.INVALID_PARAMETERS", "参数异常"),
    SYSTEM_ERROR("isp.SYSTEM_ERROR", "系统错误"),
    MOBILE_NUMBER_ILLEGAL("isv.MOBILE_NUMBER_ILLEGAL", "非法手机号"),
    MOBILE_COUNT_OVER_LIMIT("isv.MOBILE_COUNT_OVER_LIMIT", "手机号码数量超过限制"),
    TEMPLATE_MISSING_PARAMETERS("isv.TEMPLATE_MISSING_PARAMETERS", "模版缺少变量"),
    BUSINESS_LIMIT_CONTROL("isv.BUSINESS_LIMIT_CONTROL", "业务限流"),
    INVALID_JSON_PARAM("isv.INVALID_JSON_PARAM", "JSON参数不合法，只接受字符串值"),
    BLACK_KEY_CONTROL_LIMIT("isv.BLACK_KEY_CONTROL_LIMIT", "黑名单管控"),
    PARAM_LENGTH_LIMIT("isv.PARAM_LENGTH_LIMIT", "参数超出长度限制"),
    PARAM_NOT_SUPPORT_URL("isv.PARAM_NOT_SUPPORT_URL", "不支持URL"),
    AMOUNT_NOT_ENOUGH("isv.AMOUNT_NOT_ENOUGH", "账户余额不足"),
    SignatureDoesNotMatch("SignatureDoesNotMatch", "指定的签名与我们的计算机不匹配"),
    InvalidTimeStamp("InvalidTimeStamp.Expired", "时间戳或日期已过期"),
    SignatureNonceUsed("SignatureNonceUsed", "签名随机数已被使用"),
    InvalidVersion("InvalidVersion", "版本无效"),
    InvalidAction("InvalidAction.NotFound", "未找到指定的API，请检查您的URL和方法"),
    SIGN_COUNT_OVER_LIMIT("isv.SIGN_COUNT_OVER_LIMIT", "一个自然日中申请签名数量超过限制"),
    TEMPLATE_COUNT_OVER_LIMIT("isv.TEMPLATE_COUNT_OVER_LIMIT", "一个自然日中申请模板数量超过限制"),
    SIGN_NAME_ILLEGAL("isv.SIGN_NAME_ILLEGAL", "签名名称不符合规范"),
    SIGN_FILE_LIMIT("isv.SIGN_FILE_LIMIT", "签名认证材料附件大小超过限制"),
    SIGN_OVER_LIMIT("isv.SIGN_OVER_LIMIT", "签名字符数量超过限制"),
    TEMPLATE_OVER_LIMIT("isv.TEMPLATE_OVER_LIMIT", "模板字符数量超过限制"),
    SIGNATURE_BLACKLIST("SIGNATURE_BLACKLIST", "签名黑名单"),
    SHORTURL_OVER_LIMIT("isv.SHORTURL_OVER_LIMIT", "一天创建短链数量超过限制"),
    NO_AVAILABLE_SHORT_URL("isv.NO_AVAILABLE_SHORT_URL", "无有效短链"),
    SHORTURL_NAME_ILLEGAL("isv.SHORTURL_NAME_ILLEGAL", "短链名称非法"),
    SOURCEURL_OVER_LIMIT("isv.SOURCEURL_OVER_LIMIT", "原始链接字符数量超过限制"),
    SHORTURL_TIME_ILLEGAL("isv.SHORTURL_TIME_ILLEGAL", "短链有效期期限超过限制"),
    PHONENUMBERS_OVER_LIMIT("isv.PHONENUMBERS_OVER_LIMIT", "上传手机号个数超过上限"),
    SHORTURL_STILL_AVAILABLE("isv.SHORTURL_STILL_AVAILABLE", "原始链接生成的短链仍在有效期内"),
    SHORTURL_NOT_FOUND("isv.SHORTURL_NOT_FOUND", "没有可删除的短链"),
    ERROR_SIGN_NOT_MODIFY("isv.ERROR_SIGN_NOT_MODIFY", "签名不支持修改"),
    ;


    private String code;
    private String message;

    AliErrorCodeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(String code){
        for (AliErrorCodeEnum e : AliErrorCodeEnum.values()) {
            if(code.equals(e.getCode())){
                return e.getMessage();
            }
        }
        return "未知错误";
    }
}
